package com.lkcg.demo.api;

import com.lkcg.demo.common.mybatis.PageEntity;
import com.lkcg.demo.dao.MyTestDAO;
import com.lkcg.demo.service.SimpleManageService;
import com.lkcg.demo.utils.api.ResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;

@Controller
public class HomeApiController {
    @Autowired
    private SimpleManageService simpleManageService;

    @RequestMapping("/")
    @ResponseBody
    ResultObject home() {
        return ResultObject.getResultObject(()->{
            PageEntity pageEntity = new PageEntity();
            pageEntity.setPage(1);
            pageEntity.setSize(15);
            pageEntity.setParam(new HashMap());
            List<Object> list =  simpleManageService.initObjectDAO(MyTestDAO.class)
                    .getObjectList(new HashMap());

            return list;
        });

    }
}
